//
//  OutButtonTableViewCell.m
//  Findif
//
//  Created by Mac on 2019/2/22.
//  Copyright © 2019年 Cicel Chen. All rights reserved.
//

#import "OutButtonTableViewCell.h"

@interface OutButtonTableViewCell ()

@property (nonatomic, weak)UIButton * outButton;

@end


@implementation OutButtonTableViewCell


- (void)setString:(NSString *)string{
    
    _string = string;
    
    [self.outButton setTitle:string forState:UIControlStateNormal];
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    if ([super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self setupUI];
    }
    
    return self;
}

- (void)setupUI{
    
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    self.backgroundColor = ColorWithRGB(0xF4F5F6);
    
    UIButton * outButton = [UIButton new];
    
    [outButton setBackgroundColor:ColorWithRGB(0xFF5C5C)];
    [outButton setTitle:@"退出本社团" forState:UIControlStateNormal];
    [outButton setTitleColor:ZRWhiteColor forState:UIControlStateNormal];
    outButton.titleLabel.font = [UIFont systemFontOfSize:16 * SCREENH6];
    outButton.layer.cornerRadius = 5 * SCREENH6;
    outButton.layer.masksToBounds = YES;
    [outButton addTarget:self action:@selector(clickButton) forControlEvents:UIControlEventTouchUpInside];
    
    self.outButton = outButton;
    
    [self.contentView addSubview: self.outButton];
}


- (void)layoutSubviews{
    
    [self.outButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.contentView);
        make.height.mas_equalTo(35 * SCREENH6);
        make.width.mas_equalTo(250 * SCREENH6);
        make.centerY.mas_equalTo(self.contentView);
    }];
}

- (void)clickButton{
    
    if (self.delegate && [self.delegate respondsToSelector:@selector(clickOutButton)])
    {
        
        [self.delegate clickOutButton];
    }
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
